package com.gjintel.business.professerinfo.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.gjintel.business.professerinfo.dao.IProfesserDao;
import com.gjintel.business.professerinfo.model.Professer;
import com.gjintel.sdk.base.dao.HibernateGenericDAO;

@Repository("professerDao")
public class ProfesserDaoImpl extends HibernateGenericDAO implements IProfesserDao {

	@SuppressWarnings("unchecked")
	@Override
	public List<Professer> findProfesser(String projId) {
		String hql = "from Professer p where p.proj_id = '"+ projId +"'";
		return this.find(hql);
	}

	@SuppressWarnings("unchecked")
	@Override
	public String findNameById(String projId) {
		String hql = "select pr.name from ProjectInfo pr where pr.id = '"+ projId +"'";
		List<String> names = this.find(hql);
		return names.get(0);
	}

	@SuppressWarnings("unchecked")
	@Override
	public String findCodeById(String projId) {
		String hql = "select pr.code from ProjectInfo pr where pr.id = '"+ projId +"'";
		List<String> codes = this.find(hql);
		return codes.get(0);
	}

}
